﻿<%@ Page Title="" Language="C#" MasterPageFile="~/common/AfterLogin.master" AutoEventWireup="true" CodeFile="saving_trend.aspx.cs" Inherits="product_saving_user_Default" %><%@ Register assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="html_css" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="html_js" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="leftMenu" Runat="Server">
    <ul>
        <li><a href='<%= Page.ResolveUrl("~/product/saving/user/saving_summary.aspx")%>'>
            Summary</a></li>
        <li><a href='<%= Page.ResolveUrl("~/product/saving/user/saving_trend.aspx")%>'>
            Graph of Total Income</a></li>
         
    </ul>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="content" Runat="Server">
    <p>
        <asp:DropDownList ID="ddlMonth" runat="server" AutoPostBack="True" 
            onselectedindexchanged="Page_Load">
            
        </asp:DropDownList>
    </p>
    <p>
        <br />
        <asp:Chart ID="Chart1" runat="server" DataSourceID="Trend" Height="439px" 
            onload="Chart1_Load" Width="711px">
            <series>
                <asp:Series Name="Series1" XValueMember="transactionDate" 
                    YValueMembers="transactionAmount" >
                </asp:Series>
            </series>
            <chartareas>
                <asp:ChartArea Name="ChartArea1">
                </asp:ChartArea>
            </chartareas>
            <Titles>
                <asp:Title Name="Title" Text="Credit vs Debit ($)">
                </asp:Title>
            </Titles>
        </asp:Chart>
        <asp:SqlDataSource ID="Trend" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            SelectCommand="SELECT CONVERT(Nvarchar(20),  transactionDate, 103) AS transactionDate, SUM(transactionAmount) transactionAmount  FROM SUMMARY 
            WHERE CONVERT(varchar(6),  transactionDate, 112)  = @transactionDate 
            and accountNo=@accountNo
            GROUP BY transactionDate"
            
            >
            <SelectParameters>
                <asp:ControlParameter ControlID="ddlMonth" DbType="String" Name="transactionDate" 
                    PropertyName="SelectedValue" />
                    <asp:SessionParameter Name="accountNo" SessionField="savingAccountNo" 
                    Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
    </p>
</asp:Content>

